#pragma config(Sensor, in1,    light,          sensorReflection)
#pragma config(Sensor, in2,    line1,          sensorLineFollower)
#pragma config(Sensor, in3,    line2,          sensorLineFollower)
#pragma config(Sensor, in4,    line3,          sensorLineFollower)
#pragma config(Sensor, dgtl1,  bumper,         sensorTouch)
#pragma config(Sensor, dgtl2,  sonar,          sensorSONAR_inch)
#pragma config(Motor,  port2,           LeftBack,      tmotorVex269, openLoop)
#pragma config(Motor,  port3,           LeftFront,     tmotorVex269, openLoop)
#pragma config(Motor,  port4,           RightBack,     tmotorVex269, openLoop, reversed)
#pragma config(Motor,  port5,           RightFront,    tmotorVex269, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//750 ms ~90 degree turn.
void boxmovement(int turntime, int shorttime, int longtime,int loops);
void turnleft(int turntime);
void turnright(int turntime);
bool on = true;
task main()
{
  int turntime = 75;
  int shorttime = 310;
  int longtime =54350;
  int loops = 1;
  boxmovement(turntime,shorttime,longtime,loops);
}

void turnleft(int turntime)
{
  motor[LeftFront] = -122;
  motor[LeftBack] = -122;
  motor[RightFront] = 127;
  motor[RightBack] = 127;
  wait10Msec(turntime);
}
void turnright(int turntime)
{
  motor[LeftFront] = 122;
  motor[LeftBack] = 122;
  motor[RightFront] = -127;
  motor[RightBack] = -127;
  wait10Msec(turntime);
}
void boxmovement(int turntime, int shorttime, int longtime,int loops)
{

 motor[LeftFront] = 122;
  motor[LeftBack] = 122;
  motor[RightFront] = 127;
  motor[RightBack] = 127;
  wait10Msec(longtime);
  turnleft(turntime);
  motor[LeftFront] = 122;
  motor[LeftBack] = 122;
  wait10Msec(shorttime);
  turnleft(turntime);
  motor[LeftFront] = 122;
  motor[LeftBack] = 122;
  wait10Msec(longtime);
  turnleft(turntime);
  motor[LeftFront] = 122;
  motor[LeftBack] = 122;
  wait10Msec(shorttime);
  turnleft(turntime);
}
